<%--
  Created by IntelliJ IDEA.
  User: lhq12
  Date: 2019/12/18
  Time: 9:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/flat-ui.css">
    <link rel="stylesheet" href="css/demo.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
        <h3>添加用户</h3>
        <form action="addUser" method="post" onSubmit="return ifPwdEmpty();">
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>用户名</span>
                    <input name="name" type="text" placeholder="请输入用户名"  class="form-control">
                </div>
            </div>
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>密码</span>
                    <input id="password" name="password" type="password" placeholder="请输入密码"  class="form-control">
                </div>
            </div>
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>确认密码</span>
                    <input id="password1" name="password1" type="password" placeholder="确认密码"  class="form-control">
                </div>
            </div>
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>地址</span>
                     <input name="address" type="text" placeholder="请输入地址"  class="form-control">
                </div>
            </div>
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>Email</span>
                    <input name="email" type="email" placeholder="请输入Email"  class="form-control">
                </div>
            </div>
            <div class="col" style="width: 250px">
                <div class="form-group has-success">
                    <span>手机号</span>
                    <input name="phone" type="number" placeholder="请输入你的手机号码"  class="form-control">
                </div>
            </div>


            <div class="col" style="width: 250px">
                <input type="submit" value="添加" class="btn btn-block btn-lg btn-primary">
            </div>

        </form>
</div>
</body>
<script>
    function ifPwdEmpty(){
        console.log('执行了登录密码验证');
/*var pwd=document.getElementsByTagName("input");
for(var i=0;i<pwd.length;i++){
if(pwd[i].type=='password'&&pwd[i].value==0){
alert("请输入密码！");
pwd[i].focus();
return false;
}
}*/
        var newPassword=document.getElementById("password");
        var rePasswourd=document.getElementById("password1");
        if(newPassword.value!==rePasswourd.value){
            // document.getElementById("sure2").disable = disable;
            // document.getElementById("sure2").innerHTML="两次密码不相同";
            alert("输入密码不一致，请重新输入！");
            rePasswourd.value="";
            rePasswourd.focus();
            return false;
    }
}


</script>
</html>
